﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using Model;
using BLL;
using System.Data.SqlClient;

namespace DiChanAPI.Controllers
{
    public class LoginController : ApiController
    {
        // GET api/login
        [HttpGet]
 
        [ActionName("GetLogin")]
        public Login GetLogin([FromUri]Users users)        
        {
            return new LoginBLL().GetListID(users);
        }

        // GET api/login/5
        public string Get(int id)
        {
            return "value";
        }

        // POST api/login
        public void Post([FromBody]string value)
        {
        }

        // PUT api/login/5
        public void Put(int id, [FromBody]string value)
        {
        }

        // DELETE api/login/5
        public void Delete(int id)
        {
        }

        [ActionName("GetCodeImg")]
        public dynamic GetCodeImg()
        {
            string code = string.Empty;
            byte[] imgByte = ValidateCode.CreateValidateGraphic(out code, 4, 100, 40, 20);
            return new
            {
                code = code.ToLower(),
                imgByte = imgByte,
            };
        }

    }
}
